{extend name="public/container"}
{block name="content"}
<style>
    #myApp{
        width: 400px;
        margin: auto;
        margin-top: 50px;
    }
</style>
<div id="myApp">
    <el-button type="primary" @click="refreshCache">刷新数据缓存</el-button>
    <el-button type="warning" @click="deleteCache">清除缓存</el-button>
    <el-button type="danger" @click="deleteLog">清除日志</el-button>
</div>
{/block}
{block name="script"}
<script>
    var my = new Vue({
        el: "#myApp",
        methods: {
            refreshCache(){
                this.$confirm('操作后runtime目录文件有可能被删除,请谨慎操作！您确定要进行此操作吗？ 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    console.log(11)
                    axios.get(Url('system.clear/refresh_cache')).then(res => {
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            deleteCache(){
                this.$confirm('操作后runtime目录文件有可能被删除,请谨慎操作！您确定要进行此操作吗？ 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios.get(Url('system.clear/delete_cache')).then(res => {
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            deleteLog(){
                this.$confirm('操作后runtime目录文件有可能被删除,请谨慎操作！您确定要进行此操作吗？ 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios.get(Url('system.clear/delete_log')).then(res => {
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                    })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            }
        }
    });

</script>
{/block}